<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>账号管理-管理系统</title>
        <meta name="keywords" content="管理系统">
        <meta name="description" content="管理系统">
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black"> 
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="{$sys_url.static}layui/css/layui.css" media="all">
        <script src="{$sys_url.static}layui/layui.js" charset="utf-8"></script>
        <script src="{$sys_url.static}layui/date.js" charset="utf-8"></script>
        <script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
    </head>
    <body>
        <div>
            <form class="layui-form" action="/Admin/Tool/mysql" method="get" onsubmit="return checkForm();">
                <div class="layui-form-item layui-elem-quote">
                    <input type="hidden" id="ispost" name="ispost" value="ispost" />
                    <input type="hidden" id="sqlsHight" name="sqlsHight" />
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">查询sql</label>
                        <div class="layui-input-block">
                            <textarea placeholder="查询sql" class="layui-textarea" name="sqls" id="sql"  style="height:{:isset($sqlsHight) ? $sqlsHight."px" : '' }">{:isset($sqls) ? $sqls : ''}</textarea>
                        </div>
                    </div>
                    <button type="submit" class="layui-btn btnSearch" style="margin-left: 50%">查询</button>

                </div>
            </form>
            {if condition="(!empty($result))"}
            ----------页面信息---------<br/>
            开始时间：{$startTime} {$startTime_u}<br/>
            结束时间：{$endTime} {$endTime_u}<br/>
            耗    时：{$endTime-$startTime}  {$endTime_u-$startTime_u}<br/>
            <h3>结果</h3>
            {foreach name="result" item="vTable" key="kTable"}
            <div style="width:100%;overflow-x:auto" class="layui-form">
                <table border="1" class="layui-table"><description>{$kTable}</description>
                    <tr>
                        {foreach name="$vTable[0]" item="vTh" key="kTh"}
                        <th>{$kTh}</th>
                        {/foreach}
                    </tr>
                    {foreach name="$vTable" item="vTd" key="kTd"}
                    <tr>
                        {foreach name="$vTd" item="vv" key="kk"}
                        <td>{$vv}</td>
                        {/foreach}
                    </tr>
                    {/foreach}

                </table>
            </div>
            {/foreach}
            <div class="layui" id="tableList" lay-filter="demo">
                {:var_dump($result)}
            </div>
            {/if}

        </div>
    </body>

    <script>
        // layui.use(['table','util'], function() {
        //
        //         var table = layui.table;
        //         var $ = layui.jquery;
        //         var form = layui.form;
        //         var util = layui.util;
        //         //加载表格
        //
        //         //重载表格
        //         $('.btnSearch').on('click', function () {
        //             var sql = $("#sql").val();
        //             location.href='{$sys_url.ctr}/index?sql='+sql;
        //         });
        // });

        function checkForm(){
            var sqlsHight=$("#sqls").height();
            $("#sqlsHight").val(sqlsHight);
            return true;
        }
        {:isset($jsMsg) ? $jsMsg : ''}
    </script>
</html>